<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>用户信息</title>
    <link rel="stylesheet" href="../../../static/web/layui/css/layui.css" th:href="@{/web/layui/css/layui.css}" />
    <link rel="stylesheet" href="../../../static/web/kitadmin/css/ztree/metro/ztree.css" th:href="@{/web/kitadmin/css/ztree/metro/ztree.css}" />
    <link rel="stylesheet" href="../../../static/web/kitadmin/css/treeselect.css" th:href="@{/web/kitadmin/css/treeselect.css}" />


    <script src="../../../static/web/layui/layui.js" th:src="@{/web/layui/layui.js}"></script>
    <script src="../../../static/web/jquery-3.3.1/jquery-3.3.1.js" th:src="@{/web/jquery-3.3.1/jquery-3.3.1.js}"></script>
    <script src="../../../static/web/kitadmin/js/common.js" th:src="@{/web/kitadmin/js/common.js}"></script>
</head>

<body>
<form class="layui-form layui-form-pane" style="margin-left: 20px;">
    <input th:value="${user.id}" type="hidden" name="id">
    <div class="layui-form-item">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
            <legend style="font-size:20px;font-weight: bold"><i class="layui-icon layui-icon-form" style="font-size:20px;"></i>基础信息</legend>
        </fieldset>
    </div>
    <div class="layui-form-item">
        <label for="username" class="layui-form-label">
            <span style="color: red">*</span>用户名
        </label>
        <div class="layui-input-inline">
            <input type="text"  id="username" name="username" th:value="${user.username}" lay-verType="tips" lay-verify="required|username" autocomplete="off" class="layui-input" readonly>
        </div>

    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label for="realName" class="layui-form-label">
                <span style="color: red;">*</span>姓名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="realName" name="realName" th:value="${user.realName}" lay-verType="tips" lay-verify="required|realName"  autocomplete="off" class="layui-input" readonly>
            </div>
        </div>
        <div class="layui-inline">
            <label for="age" class="layui-form-label">
                <span style="color: red;">*</span>年龄
            </label>
            <div class="layui-input-inline">
                <input type="text" id="age" name="age"  th:value="${user.age}" lay-verType="tips" lay-verify="required|number" autocomplete="off" class="layui-input" readonly>
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label for="email" class="layui-form-label">
            <span style="color: red;">*</span>邮箱
        </label>
        <div class="layui-input-block">
            <input type="email" id="email" style="width: 93%" name="email" th:value="${user.email}" lay-verType="tips" lay-verify="required|email" autocomplete="off" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色选择</label>
        <div class="layui-input-block">
            <span th:each="role: ${roleList}">
                <input type="checkbox" name="role" th:title="${role.remark}" lay-filter="check" th:value="${role.id}" readonly>
            </span>
        </div>
    </div>

    <div style="width: 100%;height: 55px;background-color: white;border-top:1px solid #e6e6e6;position: fixed;bottom: 1px;margin-left:-20px;">
        <div class="layui-form-item" style=" float: right;margin-right: 30px;margin-top: 8px">
            <button  class="layui-btn layui-btn-primary" id="close" style=" height:38px;line-hight:38px;">
                <i class="layui-icon layui-icon-close-fill" style="vertical-align: middle"></i> 关闭
            </button>
        </div>
    </div>
</form>


<script  type="text/javascript" th:inline="javascript">

    var roleUserList = [[${roleUserList}]];

    $(function(){
        layui.use('form', function(){
            var form = layui.form;

            for(var i in roleUserList){
                if($(':checkbox[value="'+roleUserList[i].roleId+'"]').length > 0){
                    $(':checkbox[value="'+roleUserList[i].roleId+'"]').prop("checked",true);
                }
            }

            $('#close').click(function(){
                closeWindow(window.name);
            });

            form.render();

        });
    });



</script>
</body>

</html>
